package com.cpic.rxjava;

public abstract class Obsersable<T> implements ObservableSource<T>{
    @Override
    public void subcribeObserver(Observer<T> observer) {
        subcribeObserverActual(observer);
    }

    public abstract void subcribeObserverActual(Observer<T> observer);


    public <R> Obsersable<R> map(Function<T, R> function){
        return new ObservableMap<T,R>(this,function);
    }

    public Obsersable<T> subScribeOn(int threadFlag){
        return new ObservableSubscribeOn<>(this, threadFlag);
    }

    public Obsersable<T> obverserOn(int threadFlag){
        return new ObservableObserverOn<>(this, threadFlag);
    }
    public static <T> Obsersable<T> create(ObservableOnSubscribe<T> observableOnSubscribe){
        return new ObservableCreate<>(observableOnSubscribe);

    }
}
